<html>
<head><meta charset="utf-8"><title>friendlier cargo.toml errors · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html">friendlier cargo.toml errors</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244719320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244719320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244719320">(Jul 02 2021 at 15:33)</a>:</h4>
<p>Any plans to make Cargo.toml errors a bit friendlier? right now RA kind of just dumps everything into a message and it gets kind of hard to understand. It would be nice if these errors would be a bit easier to understand <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="244719487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244719487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244719487">(Jul 02 2021 at 15:34)</a>:</h4>
<p>Do you have an example?</p>



<a name="244720496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244720496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244720496">(Jul 02 2021 at 15:41)</a>:</h4>
<p>Yeah sure just gimme a sec to reproduce it</p>



<a name="244720655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244720655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244720655">(Jul 02 2021 at 15:42)</a>:</h4>
<div class="codehilite"><pre><span></span><code>rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file
c:\Users\caval\Documents\Github\rustc_codegen_nvvm\Cargo.toml, cargo 1.55.0-nightly (9233aa06c 2021-06-22):
Failed to run `cargo metadata --manifest-path c:\Users\caval\Documents\Github\rustc_codegen_nvvm\Cargo.toml` in
`c:\Users\caval\Documents\Github\rustc_codegen_nvvm`: `cargo metadata` exited with an error: error: failed to load
manifest for workspace member
`c:\Users\caval\Documents\Github\rustc_codegen_nvvm\crates\rustc_codegen_nvvm` Caused by: failed to read
`c:\Users\caval\Documents\Github\rustc_codegen_nvvm\crates\rustc_codegen_nvvm\Cargo.toml` Caused by: The
system cannot find the file specified. (os error 2)
</code></pre></div>
<p>This is a really convoluted way of saying <code>Workspace member foo does not have a Cargo.toml</code></p>



<a name="244720809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244720809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244720809">(Jul 02 2021 at 15:43)</a>:</h4>
<p>i suspect this would need a way to tell cargo metadata to dump a json with the error that is more understandable for RA so it can then yield a friendlier error</p>



<a name="244721916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244721916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244721916">(Jul 02 2021 at 15:50)</a>:</h4>
<p>well actually, if cargo metadata is already for json usage, i dont see why it shouldnt give json in case of an error too</p>



<a name="244804709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244804709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244804709">(Jul 03 2021 at 13:10)</a>:</h4>
<p>Yeah, we should do something about this. The problem is, we currently don't have a nice UI place in the editor where we can render such an error nicely....</p>



<a name="244825804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244825804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244825804">(Jul 03 2021 at 21:46)</a>:</h4>
<p>Yeah vsc has nothing really friendly for fatal errors IMO. Although doing <code>Rust Analyzer: Workspace member foo does not have a Cargo.toml</code> would still be a huge improvement haha</p>



<a name="244826188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244826188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244826188">(Jul 03 2021 at 21:57)</a>:</h4>
<p>Could the errors be shown as diagnostics for the root <code>Cargo.toml</code> if any? And otherwise whatever rust file you have open?</p>



<a name="244826237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/friendlier%20cargo.toml%20errors/near/244826237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/friendlier.20cargo.2Etoml.20errors.html#244826237">(Jul 03 2021 at 21:58)</a>:</h4>
<p>That is nicer than a dismissable notification that you may miss completely.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>